<?php
/*
	Copyright 2006, 2007, 2008, 2009, 2010 Bastiaan Grutters
    
    This file is part of Ages of Strife website.

    Ages of Strife website is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Ages of Strife website is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Ages of Strife website.  If not, see <http://www.gnu.org/licenses/>.
 */
if( isset( $_SESSION[ 'comment_write_status' ] ) ) {
		print( "\t\t\t\t<div class=\"blok\">\r\n\t\t\t\t" . $_SESSION[ 'comment_write_status' ] . "\r\n\t\t\t\t</div><br />\r\n" );
		unset( $_SESSION[ 'comment_write_status' ] );
	}
?>
					<div class="blok" id="comments-container">
<?php
	$total_comments = get_comment_count( $history_id );
	if( $total_comments == 0 ) {
		$text = translate( "There are no comments yet" );
	}
	elseif( $total_comments == 1 ) {
		$text = translate( "There is one comment" );
	}
	else {
		$text = translate( "There are" ) . " " . number_format( $total_comments ) . " " . translate( 'comments' );
	}
?>
						<strong><?php print( $text ); ?></strong><br />
						<br />
<?php
	if( check_subscription( $history_id ) ) {
		print( "<a href=\"toggle_subscription.php?history_id=$history_id\" title=\"" . translate( 'Stop notifying me of new comments' ) . "\">" . translate( 'Stop notifying me of new comments' ) . "</a><br />" );
	}
	else {
		print( "<a href=\"toggle_subscription.php?history_id=$history_id\" title=\"" . translate( 'Notify me of new comments' ) . "\">" . translate( 'Notify me of new comments' ) . "</a><br />" );
	}
?>						
						<small>(<?php transprint( 'You will receive notifications as civilian news items' ); ?>)</small><br />
						<br />
<?php
	print_comments( get_comments( $history_id ), false );
	if( $allow_comments == 1 ) {
?>
						<div id="write-comment">
							<br />
							<strong><?php transprint( 'Write a comment' ); ?></strong><br />
							<form method="post" action="add_comment.php">
								<input type="hidden" name="history_id" value="<?php print( $history_id ); ?>" />
								<input type="hidden" id="parent_id" name="parent_id" value="-1" />
								<textarea name="content" rows="10" cols="50"></textarea><br />
								<input type="submit" value="<?php transprint( 'submit' ); ?>" />  <a href="javascript:void(null)" onclick="replyTo( -1 )" class="hidden" id="reply-to-history"><small><?php transprint( 'Reply to history item' ); ?></small></a>
							</form>
						</div>
<?php
	}
?>
					</div> <!-- close blok -->